package com.qfedu.openplateform.order.controller;

import com.qfedu.openplateform.common.entity.PopOrderData;
import com.qfedu.openplateform.common.entity.PopOrderItem;
import com.qfedu.openplateform.common.entity.ResponseData;
import com.qfedu.openplateform.common.entity.WarehouseProduct;
import com.qfedu.openplateform.order.service.PopOderDateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class OrderController {

    /**
     * 生成订单
     */
    @Autowired
    private PopOderDateService popOderDateService;

    @PostMapping("/createOrder")
    //要修改订单号id  商家id 不能重复
//    {"id":3,"orderId":3,"venderId":1,"idCompanyBranch":1,"cky2":"北京","paymentType":1,"orderType":21,"freight":20,"paysumType":1,"state":4,"yn":1,"orderSign":"扩展1","popSendPay":"扩展2","orderCreateDate":"2019-05-14 15:35:25","outboundDate":"2019-05-14 15:35:29","orderCompletetime":"2019-05-14 15:38:39","created":"2019-05-14 15:35:51","modified":"2019-05-14 15:35:54","paymentConfirmTime":"2019-05-15 15:36:02","supposePay":10,"shouldPay":100,"deligoodType":1,"idShipmenttype":70,"areaNum":1,"consName":"草根","consAddress":"白沙之路3号","consPhone":"13666666666","consMobilePhone":"13666666666","consEmail":"2018@qq.com","consPostcode":"10001","remark":"测试","jiFen":100,"carrierId":"1","storeId":1,"orderSum":110,"invoiceTitle":"个人","invoiceContentId":1,"invoiceType":"1","sellerOrderSum":110,"couponEventSum":10,"dispathId":1,"dispathName":"北京","province":1,"city":1,"county":1,"town":1,"invoiceState":1,"balanceUsed":1,"consIndex":"合并","pin":"qf","customerip":"10.3.3.3","centerId":1,"operator":1,"vatInfo":"发票","recommendDeliveryId":1,"salesPin":"导购1号","supplier":1,"popOrderItemList":[{"id":3,"orderId":3,"venderId":1,"skuId":30001,"skuName":"手机","num":1,"warranty":"2","price":1399,"givePoint":100,"created":"2019-05-14 15:42:49","modified":"2019-05-14 15:42:52","wareId":6001,"outerId":"6001","itemNum":"1","itemExt":"扩展"}]}
    public String createOrder(@RequestBody PopOrderData popOrderData){
        popOderDateService.createOrder( popOrderData);
        System.out.println(popOrderData);
        return "ok";

    }

    @RequestMapping("findOrder")
    public List<PopOrderData> findOrder(PopOrderData popOrderData){
        List<PopOrderData> order = popOderDateService.findOrder(popOrderData);
        System.out.println(order);
        return order;

    }


}
